import Vue from 'vue';
import VueRouter from '../../Vue-Router.js';
import Index from '../views/Index.vue';
// 1. 注册路由插件
Vue.use(VueRouter);

// 路由规则
const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index
  },
  {
    path: '/blog',
    name: 'Blog',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "blog" */ '../views/Blog.vue')
  },
  {
    path: '/photo',
    name: 'Photo',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "photo" */ '../views/Photo.vue')
  }
];
// 2. 创建 router 对象
const router = new VueRouter({
  mode: 'hash',
  routes
});

export default router;
